package com.yan.club.sys.mapper;

import com.yan.club.sys.dto.SysDictDataDto;
import com.yan.club.sys.model.SysDictData;
import com.yan.club.sys.model.SysDictDataExample;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 彦
 * @since 2024/2/7 14:23
 */
@Mapper
public interface SysDictDataMapper {
    long countByExample(SysDictDataExample example);

    int deleteByExample(SysDictDataExample example);

    /**
     * delete by primary key
     *
     * @param dictCode primaryKey
     * @return deleteCount
     */
    int deleteByPrimaryKey(Long dictCode);

    /**
     * insert record to table
     *
     * @param record the record
     * @return insert count
     */
    int insert(SysDictData record);

    int insertOrUpdate(SysDictData record);

    int insertOrUpdateSelective(SysDictData record);

    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(SysDictData record);

    List<SysDictData> selectByExample(SysDictDataExample example);

    /**
     * select by primary key
     *
     * @param dictCode primary key
     * @return object by primary key
     */
    SysDictData selectByPrimaryKey(Long dictCode);

    int updateByExampleSelective(@Param("record") SysDictData record, @Param("example") SysDictDataExample example);

    int updateByExample(@Param("record") SysDictData record, @Param("example") SysDictDataExample example);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(SysDictData record);

    /**
     * update record
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKey(SysDictData record);

    int updateBatch(List<SysDictData> list);

    int updateBatchSelective(List<SysDictData> list);

    int batchInsert(@Param("list") List<SysDictData> list);

    /**
     * 根据条件分页查询字典数据
     *
     * @param dictData 字典数据信息
     * @return 字典数据集合信息
     */
    List<SysDictData> selectDictDataList(SysDictDataDto dictData);

    /**
     * 查询字典数据
     *
     * @param dictType 字典类型
     * @return 字典数据
     */
    int countDictDataByType(String dictType);

    /**
     * 同步修改字典类型
     *
     * @param oldDictType 旧字典类型
     * @param newDictType 新旧字典类型
     * @return 结果
     */
    int updateDictDataType(@Param("oldDictType") String oldDictType, @Param("newDictType") String newDictType);


    /**
     * 新增字典数据信息
     *
     * @param dictData 字典数据信息
     * @return 结果
     */
    int insertDictData(SysDictData dictData);

    /**
     * 修改字典数据信息
     *
     * @param dictData 字典数据信息
     * @return 结果
     */
    int updateDictData(SysDictData dictData);
}